<?php

namespace app\api2\controller;

use think\Controller;
use think\Request;
use think\Cache;

class AuthController extends Controller
{
	public $Success = true;
	public $Msg = "";
	public $Data = "";
	protected $UserInfo;
    //验证token值
    public function __construct()
    {
    	var_dump($_SERVER);exit;
    	$token = Request::instance()->get('access_token')?Request::instance()->get('access_token'):0;
    	if($token == 0)
    	{
    		$this->Msg = "access_token已失效,请重新登录！";
			echo $this->Msg;
			exit;
    	}
    	if(!Cache::get($token))
    	{
    		$this->Msg = "access_token已失效,请重新登录！";
    		echo $this->Msg;
    		exit;
    	}
    	return $this->UserInfo['uid'] = Cache::get($token);
    }
    
    function call(){
    	return UtilController::jsonResponse(['Success'=>$this->Success,'Msg'=>$this->Msg,'Data'=>$this->Data]);
    }
    
	
}
